package com.zscat.mallplus.config;

import com.zscat.mallplus.dms.service.impl.DouyinTokenTask;
import com.zscat.mallplus.dms.service.impl.OrderStatusTask;
import org.quartz.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//订单定时更新配置
//这个类主要是做配置类去配置JobDetail，Trigger即配置工作明细，和触发器，
//定时任务配置类
@Configuration
public class OrderStatusConfig {
    @Bean
    public JobDetail jobDetail3() {
        return JobBuilder.newJob(OrderStatusTask.class).storeDurably().build();
    }

    @Bean
    public Trigger trigger3() {
        ScheduleBuilder schdule = CronScheduleBuilder.cronSchedule("* */2 * * * ?");
        //forJob就时绑定工作明细
        return TriggerBuilder.newTrigger().forJob(jobDetail3()).withSchedule(schdule).build();
    }

}

